<?=view('admin.common.header')?>
<div class="panel panel-default">
    <div style="width: 30%; height: 300px; position: absolute; left: 50%; top: 50%; margin-left: -15%; margin-top: -150px;">
        <form id="loginform" class="form-horizontal" method="post">
            <div class="form-group">
                <div class="col-sm-12">
                    <input type="text" name="name" class="form-control" placeholder="用户帐号">
                    <input type="hidden" name="_token" value="<?=  csrf_token() ?>">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-12">
                    <input type="password" name="password" class="form-control" placeholder="用户密码">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-12">
                    <button type="submit" class="btn btn-success form-control evelogin">登　录</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    $(function(){
        $('.evelogin').click(function(){
            if ($('input[name=name]').val() == '') {
                layer.msg('登录帐号不能为空');
                return false;
            }
            if ($('input[name=password]').val() == '') {
                layer.msg('登录密码不能为空');
                return false;
            }
            $("#loginform").ajaxSubmit(function(data){
                layer.msg(data.info);
                if (data.status == 1) {
                    window.location.href="<?=url("admin/product/index")?>";
                }
            });
            return false;
        });
    });
</script>
</body>
</html>